import React, { Component, PropTypes } from 'react';

import { Navigator , View } from 'react-native';

import IndexPage from './views/index';

import DetailPage from './views/detail';

class Home extends Component {
  render() {
    return (
        <Navigator
            initialRoute={{ index: 0 ,show :true }}
            renderScene={ (route, navigator) =>
                <MyPage route={route} navigator={navigator}/>
            } configureScene={(route) => {
                if(route.index == 1) {
                    return Navigator.SceneConfigs.PushFromRight;
                } else {
                    return Navigator.SceneConfigs.FloatFromLeft;
                }
            }}
        />
    )
  }
};

class MyPage extends Component {
  render() {
    let route = this.props.route;
    return (
        <View>{ this.getPageByIndexRender( route.index ) }</View>
    )
  }
  getPageByIndexRender (index) {
      let navigator = this.props.navigator;
      switch (index) {
         case 0 :
            return ( <IndexPage navigator={navigator}/> )
            break;
          case 1:
            return ( <DetailPage navigator={navigator}/> )
      }
  }
};

export default Home;







